/**
 * @date 2006-5-9 17:19:25
 *
 */
package org.nanhill.moo.dao.hibernate;

import org.nanhill.moo.dao.GoalDao;
import org.nanhill.moo.domain.goal.Goal;
import org.nanhill.support.hibernate.HibernateEntityManager;

/**
 * @author alin [xalinx at gmail dot com]
 * 
 */
public class GoalDaoImpl extends HibernateEntityManager<Goal, Long>
		implements GoalDao {

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.moo.dao.GoalDao#read(java.lang.String)
	 */
	public Goal findByName(String goalName) {
		return this.findOne("from Goal p where p.name = ?", goalName);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.nanhill.moo.dao.GoalDao#read(java.lang.Class)
	 */
	public <E extends Goal> Goal findByClass(Class<E> subClass) {
		return this.findOne("from Goal p where p.class = ?", subClass);
	}

}
